package com.internship.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.internship.dao.AdminDao;
import com.internship.model.Admin;
import com.internship.page.Page;

@Service
public class AdminService {
	private final int PAGE_SIZE = 10;
	@Autowired
	private AdminDao adminDao;

	public Admin getAdminByteacherNumber(String teacherNumber) {
		return adminDao.getAdminByteacherNumber(teacherNumber);
	}
	public Page<Admin> getAdminsList(String deptName,String teacherName,int pageNumber) {
		Page<Admin> page = new Page<Admin>(pageNumber, PAGE_SIZE);
		List<Admin> list = adminDao.getAdminsList(deptName, teacherName, page);
		page.setResultList(list);
		return page;
	}
	public List<Admin> getAdminsList() {
		List<Admin> list = adminDao.getAdminsList();
		return list;
	}
	public int addAdmin(Admin admin) {
		return adminDao.addAdmin(admin);
	}
	public int updateAdmin(Admin admin) {
		return adminDao.updateAdmin(admin);
	}
	public int delAdmin(String teacherNumber) {
		return adminDao.delAdmin(teacherNumber);
	}
	public int delAll(String[] ids) {
		return adminDao.delAll(ids);
	}

}
